<template>
  <div class="keyword-box">
    <dl class="box-dl">
      <dt class="box-dt">{{ currentCity.cityName }}区域楼盘</dt>
      <dd class="box-dd">
        <a v-for="item, index in regionList" :key="index" :href="prefixUrl + item.href" :data-aliases="item.aliases"
          :class="setChecked(splitPageUrlArr, item.aliases) ? 'checked' : ''" :title="item.shortName"
          v-show="item.shortName != '全部'" target="_blank">{{ `${item.shortName}楼盘` }}</a>
      </dd>
    </dl>
    <dl class="box-dl" v-if="streetList.length > 0">
      <dt class="box-dt">{{ currentCity.cityName }}街道楼盘</dt>
      <dd class="box-dd">
        <a v-for="item, index in streetList" :key="index" :href="prefixUrl + item.href" :data-aliases="item.aliases"
          :class="setChecked(splitPageUrlArr, item.aliases) ? 'checked' : ''"
          :title="item.name" target="_blank">{{ `${item.name}楼盘` }}</a>
      </dd>
    </dl>
    <dl class="box-dl">
      <dt class="box-dt">周边城市</dt>
      <dd class="box-dd">
        <a href="https://cq.mfgjw.com" title="重庆新房" target="_blank">重庆新房</a>
        <a href="https://su.mfgjw.com" title="苏州新房" target="_blank">苏州新房</a>
        <a href="https://sh.mfgjw.com" title="上海新房" target="_blank">上海新房</a>
        <a href="https://cd.mfgjw.com" title="成都新房" target="_blank">成都新房</a>
        <a href="https://jx.mfgjw.com" title="嘉兴新房" target="_blank">嘉兴新房</a>
      </dd>
    </dl>
  </div>
</template>
<script>
export default {
  props: {
    currentCity: {
      type: Object,
      default() {
        return {
          cityName: ''
        }
      }
    },
    prefixUrl: {
      type: String,
      default() {
        return 'https://mfgjw.com'
      }
    },
    regionList: {
      type: Array,
      default() {
        return []
      }
    },
    streetList: {
      type: Array,
      default() {
        return []
      }
    },
    splitPageUrlArr: {
      type: Array,
      default() {
        return []
      }
    }
  },
  methods: {
    // 筛选选中
    setChecked(arr, aliases) {
      let flag = false
      for (let i = 0; i < arr.length; i++) {
        if (arr[i] == aliases) {
          flag = true
          break
        }
      }
      return flag
    }
  }
}
</script>